﻿<cfsilent>
	<cfscript>
		
		workloadFactory = getProperty("serviceFactory").getBean("workloadFactory");
		
		event.setArg("pageTitle", "师资工作量 - 工作量计算公式");
		
		currentTab = event.getArg("TabID", "labCreate");
		
		passArgs = structNew();
		
		templateId = event.getArg("TP");

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
            <div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('workFuntion')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">工作量计算公式</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 config"></i>新建公式
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCreate">class="active"</cfif> id="labCreate" tabTarget="Create">创建新公式</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="Create" class="tabContent">
					
					<div class="noticeBlock">
						<h3>设置新的计算公式</h3>
						<p><span class="img icon16x16 message"></span>请根据学校实际情况选择教学工作量计算公式模版, 设置对应的调节参数</p>
						<hr/>
					</div>
					
					<cfif len(templateId) >
							
							<div class="noticeBlock">
								<h2>第二步：设置模版参数</h2>
							</div>
							
							<div class="mtl mbl">
								<img src="/barcode/latex?msg=<cfoutput>#URLEncodedFormat( workloadFactory.getLatexTemplate( templateId ), 'iso-8859-1' )#</cfoutput>"/>
							</div>
							
							<form id="formCreate" onSubmit="javascript:return processVerfiyForm('formCreate');" class="formWrapper" method="post" action="<cfoutput>#buildURL('workFuntionCreateDo')#</cfoutput>">
								
								<input type="hidden" name="FunMethod" value="<cfoutput>#templateId#</cfoutput>" />

								<cfset argsArray = workloadFactory.getLatexTemplateArgs( templateId ) />
								
								<cfset hasF = false />

								<cfloop array="#argsArray#" index="argSet">
									<cfif argSet[3] eq "F"><cfset hasF = true /></cfif>
								</cfloop>
								
								<cfif hasF>
									<div class="label">
										<span class="req">*</span><b>参数</b>
										<cfloop array="#argsArray#" index="argSet">
											<cfif argSet[3] eq "F">
												<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
												=
												<input name="<cfoutput>#argSet[1]#</cfoutput>" id="<cfoutput>#argSet[1]#</cfoutput>" type="text" class="typeTinyInt" verification="double" value="" />
											</cfif>
										</cfloop>
										<p class="notice">
											参数说明: 
											<cfloop array="#argsArray#" index="argSet">
												<cfif argSet[3] eq "F">
													<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
													<cfoutput>#argSet[2]#</cfoutput>
												</cfif>
											</cfloop>
										</p>
									</div>
								</cfif>
								
								<div class="label">
									<span class="req">*</span><b>公式名称</b>
									<input name="FunName" id="FunName" type="text" class="typeTextShort" verification="required" maxlength="30" value="<cfoutput>#event.getArg('FunName')#</cfoutput>" />
								</div>
								
								<div class="label">
									<b>说明</b>
									<textarea name="FunDescription" id="FunDescription" verification="required" ><cfoutput>#event.getArg('FunDescription')#</cfoutput></textarea>
								</div>
								
								<hr/>
						
								<div class="lable">
									<input class="button1" type="submit" value="添加" />
									<a class="button" href="<cfoutput>#buildURL('workFuntion')#</cfoutput>">返回</a>
								</div>
								
							</form>
							
						<cfelse>

							<div class="noticeBlock">
								<h2>第一步：选择公式模版</h2>
							</div>
							
							<div class="noticeBlock">
								<h3>理论课</h3>
								<hr/>
							</div>

							<div class="UIFormula">

								<cfset i = 0 />
								<cfloop list="L1" index="templateId" delimiters=", ">
							
									<cfset i++ />
									<cfset structInsert( passArgs, "TP", templateId, true ) />
							
									<div class="col2 <cfif i mod 2 eq 0>last</cfif>">
							
										<div class="board">

											<a href="<cfoutput>#buildURL('workFuntionCreate', passArgs)#</cfoutput>">
												<div class="LaTex">
													<img src="/barcode/latex?msg=<cfoutput>#URLEncodedFormat( workloadFactory.getLatexTemplate( templateId ), 'iso-8859-1' )#</cfoutput>"/>
												</div>

												<cfset argsArray = workloadFactory.getLatexTemplateArgs( templateId ) />
								
												<cfset hasT = false />
												<cfset hasF = false />
								
												<cfloop array="#argsArray#" index="argSet">
													<cfif argSet[3] eq "T"><cfset hasT = true /></cfif>
													<cfif argSet[3] eq "F"><cfset hasF = true /></cfif>
												</cfloop>

												<cfif hasT>
													<div class="argsList">
														<cfloop array="#argsArray#" index="argSet">
															<cfif argSet[3] eq "T">
																<span>
																	<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
																	<cfoutput>#argSet[2]#</cfoutput>
																</span>
															</cfif>
														</cfloop>
													</div>
												</cfif>
							
												<cfif hasF>
													<div class="argsList">
														<cfloop array="#argsArray#" index="argSet">
															<cfif argSet[3] eq "F">
																<span>
																	<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
																	<cfoutput>#argSet[2]#</cfoutput>
																</span>
															</cfif>
														</cfloop>
													</div>
												</cfif>
											</a>
							
										</div>
							
									</div>

								</cfloop>
						
							</div>
							
							<div class="clearfix"><!--.--></div>
							
							<div class="noticeBlock">
								<h3>实践课</h3>
								<hr/>
							</div>
							
							<div class="UIFormula">

								<cfset i = 0 />
								<cfloop list="S2, S3, S4, S1, S5" index="templateId" delimiters=", ">
							
									<cfset i++ />
									<cfset structInsert( passArgs, "TP", templateId, true ) />
							
									<div class="col2 <cfif i mod 2 eq 0>last</cfif>">
							
										<div class="board">

											<a href="<cfoutput>#buildURL('workFuntionCreate', passArgs)#</cfoutput>">
												<div class="LaTex">
													<img src="/barcode/latex?msg=<cfoutput>#URLEncodedFormat( workloadFactory.getLatexTemplate( templateId ), 'iso-8859-1' )#</cfoutput>"/>
												</div>

												<cfset argsArray = workloadFactory.getLatexTemplateArgs( templateId ) />
								
												<cfset hasT = false />
												<cfset hasF = false />
								
												<cfloop array="#argsArray#" index="argSet">
													<cfif argSet[3] eq "T"><cfset hasT = true /></cfif>
													<cfif argSet[3] eq "F"><cfset hasF = true /></cfif>
												</cfloop>

												<cfif hasT>
													<div class="argsList">
														<cfloop array="#argsArray#" index="argSet">
															<cfif argSet[3] eq "T">
																<span>
																	<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
																	<cfoutput>#argSet[2]#</cfoutput>
																</span>
															</cfif>
														</cfloop>
													</div>
												</cfif>
							
												<cfif hasF>
													<div class="argsList">
														<cfloop array="#argsArray#" index="argSet">
															<cfif argSet[3] eq "F">
																<span>
																	<img src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/latex/<cfoutput>#argSet[1]#</cfoutput>.png" />
																	<cfoutput>#argSet[2]#</cfoutput>
																</span>
															</cfif>
														</cfloop>
													</div>
												</cfif>
											</a>
							
										</div>
							
									</div>

								</cfloop>
						
							</div>
							
				
					</cfif>

				</div>
				
			</div>
		</li>
	</ul>
</div>